package com.hp.his.basic.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.hp.his.basic.entity.User;
import com.hp.his.core.orm.hibernate.HibernateDao;

@Repository
public class UserDao  extends HibernateDao<User, Long> {
	
	@SuppressWarnings({ "rawtypes" })
	public User getUserByName(String userName){
		String hql = "from User where USERNAME='"+userName+"'";
		Query query = getSession().createQuery(hql);
		
		List list = query.list();
		
		if(list.size()>0)
			return (User)list.get(0);
		else
			return null;
	}

}
